package com.mentaleye.service.impl;

import com.mentaleye.dal.dao.AutoFormDao;
import com.mentaleye.dal.model.AutoFormExample;
import com.mentaleye.dal.model.AutoFormWithBLOBs;
import com.mentaleye.service.AutoFormService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

@Service
public class AutoFormServiceImpl
  implements AutoFormService
{

  @Autowired
  AutoFormDao autoFormDao;

  public boolean addForm(AutoFormWithBLOBs autoForm)
  {
    return this.autoFormDao.addForm(autoForm);
  }

  public boolean addFormByLast(AutoFormWithBLOBs autoForm)
  {
    String parse=autoForm.getParse();
    autoForm.setParse(parse.replace("\\\"","\\\\\""));
    return this.autoFormDao.addFormByLast(autoForm);
  }

  public boolean editForm(AutoFormWithBLOBs autoForm, AutoFormExample example)
  {
    return this.autoFormDao.editForm(autoForm, example);
  }

  public AutoFormWithBLOBs getFormById(Integer i, Integer version)
  {
    return this.autoFormDao.getFormById(i, version);
  }

  public AutoFormWithBLOBs getFormById(Integer i)
  {
    return this.autoFormDao.getFormById(i, null);
  }

  public List<Map<String, Object>> selectByMap(Map<String, Object> map)
  {
    return this.autoFormDao.selectByMap(map);
  }
}